using System;
using System.Collections.Generic;
using System.Text;

namespace MP_Syndication
{
    public class Feed
    {
        private int    _feedId;
        // Feed properties
        private string _feedName;
        private string _feedUrl;
        private string _imagePath;
        private int    _nbItems;

        // Ticker properties
        private bool   _tickerEnabled;
        private string _separator;
        private string _property;
        private bool   _autoRefreshEnabled;
        private int    _autoRefreshInterval;

        public Feed(string feedName, string feedUrl)
            : this(feedName, feedUrl, 10)
        {
        }

        public Feed(string feedName, string feedUrl, int nbItems)
        {
            _feedId = -1;

            _feedName = feedName;
            _feedUrl  = feedUrl;
            _nbItems  = nbItems;

            _tickerEnabled = false;
            _autoRefreshEnabled = false;
        }

        public Feed(string feedName, string feedUrl, int nbItems, string imagePath,
                    bool tickerEnabled, string separator, string property, bool autoRefreshEnabled, int autoRefreshInterval)
            : this(feedName, feedUrl, nbItems)
        {
            _imagePath = imagePath;

            _tickerEnabled = tickerEnabled;
            _separator = separator;
            _property = property;
            _autoRefreshEnabled = autoRefreshEnabled;
            _autoRefreshInterval = autoRefreshInterval;
        }

        public int FeedId
        {
            get
            {
                return _feedId;
            }
            set
            {
                _feedId = value;
            }
        }

        #region Feed property accessors
        public string FeedName
        {
            get{
                return _feedName;
            }
            set
            {
                _feedName = value;
            }
        }

        public string FeedUrl
        {
            get
            {
                return _feedUrl;
            }
            set
            {
                _feedUrl = value;
            }
        }

        public string ImagePath
        {
            get
            {
                return _imagePath;
            }
            set
            {
                _imagePath = value;
            }
        }

        public int NbItems
        {
            get
            {
                return _nbItems;
            }
            set
            {
                _nbItems = value;
            }
        }
        #endregion  

        #region Ticker property accessors
        public bool TickerEnabled
        {
            get
            {
                return _tickerEnabled;
            }
            set
            {
                _tickerEnabled = value;
            }
        }
        public int TickerEnabledAsInt
        {
            get
            {
                return _tickerEnabled ? 1 : 0;
            }
            set
            {
                if (value == 1)
                    _tickerEnabled = true;
                else
                    _tickerEnabled = false;
            }
        }
        public string Separator
        {
            get
            {
                return _separator;
            }
            set
            {
                _separator = value;
            }
        }
        public string Property
        {
            get
            {
                return _property;
            }
            set
            {
                _property = value;
            }
        }
        public bool AutoRefreshEnabled
        {
            get
            {
                return _autoRefreshEnabled;
            }
            set
            {
                _autoRefreshEnabled = value;
            }
        }
        public int AutoRefreshEnabledAsInt
        {
            get
            {
                return _autoRefreshEnabled ? 1 : 0;
            }
            set
            {
                if (value == 1)
                    _autoRefreshEnabled = true;
                else
                    _autoRefreshEnabled = false;
            }
        }
        public int AutoRefreshInterval
        {
            get
            {
                return _autoRefreshInterval;
            }
            set{
                _autoRefreshInterval = value;
            }
        }
        #endregion
    }
}
